function unique(arr) {
    const res = []
    arr.forEach(item => {
        if (res.indexOf(item) < 0) {
            res.push(item)
        }
    })
    return res
}

console.log(unique([30, 10, 20, 30, 40, 10]))

function unique2(arr) {
    return [...new Set(arr)]
}

console.log(unique2([30, 10, 20, 30, 40, 10]))
